const models = require('../models');
class ManagerController{
  constructor(){

  }
  async findAll(whereObj,columnsArr){
    var result = {};
    if(whereObj.id||whereObj.cookie){
      result.where = whereObj
    }
    if(columnsArr.length){
      result.attributes = columnsArr;
    }
    const managers = await models.manager.findAll(
      result
    );
    return managers;
  }
  async update(id, updateObj){
    
    const result = await models.manager.update(
      updateObj,
      {
        where: {
          id: id
        }
      }
    );
    if(result){
      return true;
    }
    return false;
  }
}

module.exports = new ManagerController();